package Real19;

public class Main {

	
	public static void main(String[] args) {
		double d = 0;
		
		for(int i = 1; i <= 2019; i++) {
			String s = ""+i;
			boolean flag = false;
			
			for(int j= 0; j < s.length();j++)
				
				switch (s.charAt(j)) {   //switch String char *int*  Enum
					case '2': flag = true;break;
					case '0': flag = true;break;
					case '1': flag = true;break;
					case '9': flag = true;break;
					default: break;
				}
			
			if(flag == true)
				d += Math.pow(i, 2);
		}
		
		System.out.println(d);

	}

}
